package com.peza.homecontrol.daemon;

import javax.persistence.EntityManager;

import org.springframework.beans.factory.annotation.Autowired;

import com.peza.homecontrol.domain.Action;
import com.peza.homecontrol.domain.Switch;
import com.peza.homecontrol.domain.Module;

public class HomeControl {

	@Autowired
	private static EntityManager em;
	
	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException {
		
		
		Module module = new Module();
		module.setCode(1);
		module.setId(1);
		
		
		//em.persist(module);
		
		Switch event = new Switch(module,Action.OFF);
		event.execute();
		Thread.sleep(2000);
		event.setAction(Action.ON);
		event.execute();
		Thread.sleep(2000);
		event.setAction(Action.OFF);
		event.execute();
		
	}

}
